package com.acceptable.qucun.file.mapper;

import com.acceptable.qucun.file.entity.FileMime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.lang.NonNull;

import java.util.Set;

@Mapper
public interface FileMimeMapper extends BaseMapper<FileMime> {

    @Select("SELECT mime " +
            "FROM file_mime " +
            "WHERE ext = #{ext}")
    String selectMimeByExt(@NonNull String ext);

    @Select("SELECT mime " +
            "FROM file_mime " +
            "WHERE type_id=(SELECT type_id FROM file_type WHERE type_name=#{type} )")
    Set<String> selectMimeByType(@NonNull String type);
}
